<template>
  <a-layout-header style="background: #fff; padding: 0">
    <div class="header-content">
      <a-button type="link" @click="goBack">
        <a-icon type="left" /> 返回微页面
      </a-button>
      <a-alert v-if="warningMessage" message="提示" :description="warningMessage" type="warning" showIcon />
      <div class="header-buttons">
        <a-button type="primary" @click="preview">预览</a-button>
        <a-button type="primary" @click="save">保存</a-button>
        <a-dropdown>
          <a-button type="primary">
            发布 <a-icon type="down" />
          </a-button>
          <a-menu slot="overlay">
            <a-menu-item key="1">选项一</a-menu-item>
            <a-menu-item key="2">选项二</a-menu-item>
          </a-menu>
        </a-dropdown>
      </div>
    </div>
  </a-layout-header>
</template>

<script>
export default {
  data () {
    return {
      warningMessage: '在浏览器中发现未提交的内容，是否使用该内容替换当前内容？'
    };
  },
  methods: {
    goBack () {
      console.log('Go back button clicked');
    },
    preview () {
      console.log('Preview button clicked');
    },
    save () {
      console.log('Save button clicked');
    }
  }
};
</script>

<style scoped>
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
}

.header-buttons {
  display: flex;
  gap: 8px;
}
</style>